﻿using System.Collections.ObjectModel;
using BudgetPanoramaApplication.Model;
using BudgetPanoramaApplication.Framework;
using GalaSoft.MvvmLight;

namespace BudgetPanoramaApplication.ViewModels
{
    public class MainViewModel : ViewModelBase
    {
        #region Properties
        /// <summary>
        /// A collection for the menu.
        /// </summary>
        public ObservableCollection<NavigationItem> MenuItems { get; private set; }

        /// <summary>
        /// A collection for the settings 
        /// </summary>
        public ObservableCollection<NavigationItem> SettingsItems { get; private set; }

        /// <summary>
        /// Check if data are loaded already 
        /// </summary>
        public bool IsDataLoaded
        {
            get;
            private set;
        }
        #endregion 

        #region .ctor
        /// <summary>
        /// Default .ctor
        /// </summary>
        public MainViewModel()
        {
            LoadData();
        }
        #endregion

        #region LoadData
        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData()
        {
            MenuItems = new ObservableCollection<NavigationItem>();
            SettingsItems = new ObservableCollection<NavigationItem>();
            // Menu
            MenuItems.AddRange(NavigationDataSource.CreateMenuItems());
            // Settings
            SettingsItems.AddRange(NavigationDataSource.CreateSettingsItems());
            
            IsDataLoaded = true;
        }
        #endregion 
    }
}